from django.contrib import admin
from django.contrib.contenttypes.models import ContentType

from slots_demo.models import Team, Captain
from slots.admin import TransitionInline, TransitionForm

class CaptainForm(TransitionForm):
    link_to_type = ContentType.objects.get_for_model(Captain)

class CaptainInline(TransitionInline):
    link_to = Captain
    form = CaptainForm

class TeamAdmin(admin.ModelAdmin):
    inlines = [CaptainInline]
    fieldsets = ( 
        ('All', {
            'fields': ('name', 'sport')
        }),
    )

admin.site.register(Team,TeamAdmin)
admin.site.register(Captain)
